libxl: change semantics of ctx_free and remove ctx_close
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 30 Dec 2009 12:40:44 +0000 (12:40 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 30 Dec 2009 12:40:44 +0000 (12:40 +0000)
ctx_close isn't use anywhere, and free reallocate the GC array, which
is quite surprising and lead to memory leaking in xl.c

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl.h

index 043a8275517e31fb0489360d0a6980f7d369b2dd..ecc3bc27530ad5d35d7628e692a6ede95fa3c19f 100644 (file)
@@ -53,16 +53,6 @@ int libxl_ctx_free(struct libxl_ctx *ctx)
 {
     libxl_free_all(ctx);
     free(ctx->alloc_ptrs);
-    ctx->alloc_ptrs = calloc(ctx->alloc_maxsize, sizeof(void *));
-    if (!ctx->alloc_ptrs)
-        return ERROR_NOMEM;
-    return 0;
-}
-
-int libxl_ctx_close(struct libxl_ctx *ctx)
-{
-    libxl_ctx_free(ctx);
-    free(ctx->alloc_ptrs);
     xc_interface_close(ctx->xch);
     xs_daemon_close(ctx->xsh); 
     return 0;
index 3e0e281285b554073eab21a198870fc207544979..cc6ecee4d630326505c1f45456bfea57e8ef28a0 100644 (file)
@@ -253,7 +253,6 @@ void xl_log(struct libxl_ctx *ctx, int errnoval, int loglevel, const char *file,
 /* context functions */
 int libxl_ctx_init(struct libxl_ctx *ctx);
 int libxl_ctx_free(struct libxl_ctx *ctx);
-int libxl_ctx_close(struct libxl_ctx *ctx);
 int libxl_ctx_set_log(struct libxl_ctx *ctx, libxl_log_callback log_callback, void *log_data);
 
 /* domain related functions */